#include<iostream>
#include<cmath>
#include<Windows.h>
#include<cstring>
using namespace std;
#include <stdio.h>
#define N 14
int  main() {
    int a[100] = { 0 };
    int  i, g = -1;
    for (i = 0; i < 100; i++)
    {
        cin >> a[i];
        g++;
        if (a[i] == 0)
            break;
    }
    for (i = g - 1; i >= 0; i--)
    {

        cout << " " << a[i];
    }



}